]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
endSessionDialog: fix keyboard navigation
authorDan Winship <danw@gnome.org>
Wed, 6 Apr 2011 16:54:47 +0000 (12:54 -0400)
committerDan Winship <danw@gnome.org>
Thu, 14 Apr 2011 21:53:40 +0000 (17:53 -0400)
The addition of _backgroundStack to ModalDialog broke focus
navigation, because it was interposed between the focus group root and
all of the interesting content, but since it isn't an StWidget,
st_widget_navigate_focus() was unable to navigate through it. Fix this
by moving the focus root to this._dialogLayout (inside the
_backgroundStack) instead.

Additionally, in EndSessionDialog specifically, _initialKeyFocus
wasn't being set until after opening the dialog, so it was ignored.

Also change ModalDialog.close() to clear the _savedKeyFocus that
popModal() set, so that dialogs that are repeatedly closed and
reopened will have their focus revert back to _initialKeyFocus each
time.

https://bugzilla.gnome.org/show_bug.cgi?id=646740

js/ui/endSessionDialog.js
js/ui/modalDialog.js

index a10b86d0052867015b8136d11c9054888e829a9e..47963bc1ea412e58cf51e2392325f84495060b1a 100644 (file)
@@ -408,10 +408,6 @@ EndSessionDialog.prototype = {
     },
 
     _updateButtons: function() {
-        if (this.state != ModalDialog.State.OPENING &&
-            this.state != ModalDialog.State.OPENED)
-            return;
-
         let dialogContent = DialogContent[this._type];
         let buttons = [{ action: Lang.bind(this, this.cancel),
                          label:  _("Cancel"),
@@ -521,11 +517,12 @@ EndSessionDialog.prototype = {
             this._inhibitors.push(inhibitor);
         }
 
+        this._updateButtons();
+
         if (!this.open(timestamp))
             throw new DBus.DBusError('org.gnome.Shell.ModalDialog.GrabError',
                                      "Cannot grab pointer and keyboard");
 
-        this._updateButtons();
         this._updateContent();
 
         let signalId = this.connect('opened',
index 802f9c90fd72ac4dd0e7cc72594b112dbe20e5f6..dfebc479f8afcb1109d0b4d75461be641febd23f 100644 (file)
@@ -50,10 +50,6 @@ ModalDialog.prototype = {
                                                       coordinate: Clutter.BindCoordinate.POSITION | Clutter.BindCoordinate.SIZE });
         this._group.add_constraint(constraint);
 
-        global.focus_manager.add_group(this._group);
-        this._initialKeyFocus = this._group;
-        this._savedKeyFocus = null;
-
         this._group.connect('destroy', Lang.bind(this, this._onGroupDestroy));
 
         this._actionKeys = {};
@@ -94,6 +90,10 @@ ModalDialog.prototype = {
                                { expand:  true,
                                  x_align: St.Align.MIDDLE,
                                  y_align: St.Align.END });
+
+        global.focus_manager.add_group(this._dialogLayout);
+        this._initialKeyFocus = this._dialogLayout;
+        this._savedKeyFocus = null;
     },
 
     setButtons: function(buttons) {
@@ -195,6 +195,7 @@ ModalDialog.prototype = {
 
         this.state = State.CLOSING;
         this.popModal(timestamp);
+        this._savedKeyFocus = null;
 
         Tweener.addTween(this._group,
                          { opacity: 0,